﻿using System.Collections.Generic;
using System.Threading.Tasks;
using DialogueManagerRuntime;
using Godot;
using kemocard.Scripts.Common;

namespace kemocard.Scripts.Story;

public class StoryScript
{
    public virtual void Init()
    {
    }

    public virtual void OnBeginStory()
    {
    }

    public virtual void OnEndStory()
    {
    }

    public virtual List<ActionStruct> GenerateActions()
    {
        return [];
    }

    public virtual async Task OnAction(string action)
    {
        await Task.CompletedTask;
    }

    public virtual void OnEnterGameScene(int stage)
    {
    }

    public virtual async Task OnStoryOnBattleStart()
    {
        await Task.CompletedTask;
    }

    public virtual async Task OnStoryOnBattleEnd()
    {
        await Task.CompletedTask;
    }

    public virtual async Task OnStoryOnTurnStart()
    {
        await Task.CompletedTask;
    }
    
    public virtual async Task OnStoryOnBattleWin()
    {
        await Task.CompletedTask;
    }

    /// <summary>
    /// 在读档或者开启新故事时调用（晚于OnBeginStory，早于GenerateActions）
    /// 用于订阅事件，构造脚本数据等
    /// </summary>
    public virtual void OnLoad()
    {
    }
}

public record struct ActionStruct
{
    public string Id;
    public string Description;
    public object Data;
}